<!DOCTYPE html>
<html>
{include file="public/head" /}
<body class="zanpian-body">
<section class="content">
  <div class="row">
    <div class="col-md-6 col-sm-6 col-xs-12 pr0" id="html" tid="{$tid|default=''}"  tsid="{$tsid|default=''}" did="{$did|default=''}" sid="{$sid|default=''}" types="{$types|default=''}"> </div>
    <div id="contents">
      <div class="col-md-6 col-sm-6 col-xs-12">
        <div class="select-group-t w150 search m10 ">
          <select name="status" class="form-control select2 margin10" type="ajax-select" style="width:100%">
            <option value="{:url('index',array('did'=>$did,'tid'=>$tid,'tsid'=>$tsid,'sid'=>$sid,'cid'=>$cid,'wd'=>$wd,'type'=>$type,'order'=>$order,'limit'=>$limit))}">分类筛选</option>
            
{volist name=":F('_data/list'.$name)" id="vo"}
            <option value="{:url('index',array('did'=>$did,'tid'=>$tid,'tsid'=>$tsid,'sid'=>$sid,'cid'=>$vo.list_id,'wd'=>$wd,'type'=>$type,'order'=>$order,'limit'=>$limit))}" {eq name="vo.list_id" value="$cid"}selected{/eq}>
            {$vo.list_name}
            </option>
            
{if isset($vo['son'])}{volist name="vo['son']" id="splist"}
            <option value="{:url('index',array('did'=>$did,'tid'=>$tid,'tsid'=>$tsid,'sid'=>$sid,'cid'=>$splist.list_id,'wd'=>$wd,'type'=>$type,'order'=>$order,'limit'=>$limit))}" {eq name="splist.list_id" value="$cid"}selected{/eq}>
            ├ {$splist.list_name}
            </option>
            {/volist}{/if}
{/volist}

          </select>
        </div>
        <form class="form-inline form-search nice-validator n-default m10" id="form-search" method="post">
          <div class="input-group">
            <input class="form-control" placeholder="请输入关键词搜索" type="text" name="wd">
            <div class="input-group-btn">
              <button type="submit" class="btn btn-default ajax-post" title="普通搜索" form="#form-search"><i class="glyphicon glyphicon-search"></i></button>
            </div>
          </div>
        </form>
        <div class="tab-content">
          <form id="list" method="post">
            <table id="table" class="table table-striped table-bordered table-hover" style="margin-top: 0px;" width="100%">
              <thead>
                <tr>
                  <th style="text-align:center;vertical-align: middle;"> {eq name="orders" value="id desc"}<a href="{:url('index',array('did'=>$did,'tid'=>$tid,'tsid'=>$tsid,'sid'=>$sid,'cid'=>$cid,'wd'=>$wd,'type'=>'id','order'=>'asc','limit'=>$limit))}" class="text-link sort ajax-url">编号 <i class="fa fa-angle-up"></i></a>{else/}<a href="{:url('index',array('did'=>$did,'tid'=>$tid,'tsid'=>$tsid,'sid'=>$sid,'cid'=>$cid,'wd'=>$wd,'type'=>'id','order'=>'desc','limit'=>$limit))}" class="text-link sort ajax-url">编号 <i class="fa fa-angle-down"></i></a>{/eq}</th>
                  <th style="text-align:left;vertical-align: middle; width:25%">分类</th>
                  <th style="text-align:left;vertical-align: middle;">名称</th>
                  <th style="text-align:center;vertical-align: middle;">操作</th>
                </tr>
              </thead>
              <tbody>
              
              {notempty name="list"}
              {volist name="list" id="vo"}
              <tr>
                <td style="text-align:center;vertical-align: middle;">{$vo[$name.'_id']}</a></td>
                <td style="text-align:left;vertical-align: middle;">『 {:getlistname($vo[$name.'_cid'])} 』</td>
                <td style="text-align:left;vertical-align: middle;">{$vo[$name.'_name']|msubstr=0,10,'...'}</td>
                
                {notempty name="did"}
                <td align="center"><a href="javascript:;" class="btn btn-facebook btn-xs addajax" data-tid="{$vo[$name.'_id']}" data-tsid="{$tsid}" data-did="{$did}" data-sid="{$sid}" data-type="add" data-types="did"><i class="fa fa-plus-square"></i> 添加</a></td>
                {/notempty}
                
                 {notempty name="tid"}
                <td align="center"><a href="javascript:;" class="btn btn-facebook btn-xs addajax" data-tid="{$tid}" data-tsid="{$tsid}" data-did="{$vo[$name.'_id']}" data-sid="{$sid}" data-type="add" data-types="tid"><i class="fa fa-plus-square"></i> 添加</a></td>
                {/notempty}               
              </tr>
              {/volist}
              {else/}
              <tr>
                <td style="text-align:center;vertical-align: middle;" colspan="11" >抱歉，没有找到相关内容！</td>
              </tr>
              {/notempty}
              </tbody>
              
            </table>
          </form>
        </div>
      </div>
      {gt name="list->lastPage()" value="1"}
      <div class="col-md-12 col-sm-12 col-xs-12">
        <div class="panel-page">
          <div class="panel-page-url ajax-page">
            <ul class="pagination">
              {$list->render()}
              <div class="panel-page-select pull-left">
                <select class="select2 ajax-select" data-url="{:url_page(request()->action(),request()->param(),1)}">
                  <option value="10" {eq name="limit" value="10"}selected{/eq}>
                  10 条/页
                  </option>
                  <option value="20" {eq name="limit" value="20"}selected{/eq}>
                  20 条/页
                  </option>
                  <option value="30" {eq name="limit" value="30"}selected{/eq}>
                  30 条/页
                  </option>
                  <option value="40" {eq name="limit" value="40"}selected{/eq}>
                  40 条/页
                  </option>
                  <option value="50" {eq name="limit" value="50"}selected{/eq}>
                  50 条/页
                  </option>
                  <option value="99" {eq name="limit" value="99"}selected{/eq}>
                  99 条/页
                  </option>
                </select>
              </div>
              <div class="panel-page-jump ">
                <input type="input" name="page" id="page" min="1" value="{$list->currentPage()}" class="form-control"/>
                <input type="button" value="跳 转" data-url="{:url_page(request()->action(),request()->param())}" class="btn btn-default ajax-jump" />
              </div>
            </ul>
          </div>
        </div>
        <!-- /.panel-page -->
        {/gt} </div>
    </div>
  </div>
</section>
<div class="box-footer {notempty name=":request()->param('dialog')"}hidden{/notempty} layer-footer">
  <div  class="footer-btn"> {notempty name=":request()->param('dialog')"}
    <button type="reset" class="btn btn-primary btn-embossed btn-close" onClick="layer.closeAll();"> 关闭</button>
    {/notempty} </div>
</div>
{include file="public/footer" /}
<script type="text/javascript">
$(document).ready(function() {
	zanpian.cms.all();
	if ($("#html").size() > 0) {
		tid = $("#html").attr("tid");
		tsid = $("#html").attr("tsid");
		did = $("#html").attr("did");
		sid = $("#html").attr("sid");
		types = $("#html").attr("types");
		zanpian.api.relation(tid, tsid, did, sid, '', '', types);
		$(document).on("click", ".addajax", function() {
			tid = $(this).data("tid");
			tsid = $(this).data("tsid");
			did = $(this).data("did");
			sid = $(this).data("sid");
			type = $(this).data("type");
			types = $(this).data("types");
			lastdid = $(this).data("oid");
			zanpian.api.relation(tid, tsid, did, sid, type, lastdid, types);
			$(this).addClass('disabled').prop('disabled', false);
		})
	}
});
</script>
</body>
</html>
